//
//  NSAttributedString+MVVMSize.m
//  MVVMPractice
//
//  Created by iSolar on 2017/12/1.
//  Copyright © 2017年 com.ann.lmj. All rights reserved.
//

#import "NSAttributedString+MVVMSize.h"

@implementation NSAttributedString (MVVMSize)

- (CGSize)autoH_sizeWithLimitSize:(CGSize)limitSize
{
    CGSize theSize;
    CGRect rect = [self boundingRectWithSize:limitSize options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading context:nil];
    theSize.width = ceil(rect.size.width);
    theSize.height = ceil(rect.size.height);
    return theSize;
}

- (CGSize)autoH_sizeWithLimitWidth:(CGFloat)limitWidth
{
    return [self autoH_sizeWithLimitSize:CGSizeMake(limitWidth, MAXFLOAT)];
}

@end
